//
//  WithdrawAddBankCell.swift
//  d11
//
//  Created by peale on 2018/11/14.
//  Copyright © 2018年 Tech_001. All rights reserved.
//

import UIKit

class WithdrawAddBankCell: UITableViewCell {
    var bgImgView : UIImageView?
    var iconImgView : UIImageView?
    var nameLabel:UILabel?
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.setUpUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
    }
    
    func setUpUI() -> Void {
        self.backgroundColor  = UIColor.clear
        self.selectionStyle = UITableViewCell.SelectionStyle.none
        
        self.bgImgView = UIImageView.init()
        self.bgImgView?.image = imageNamed("icon_withdraw_add_bank_bg")
        self.contentView.addSubview(bgImgView!);
        self.bgImgView?.snp.makeConstraints{(make) in
            make.width.equalToSuperview()
            make.height.equalTo(66)
            make.centerX.equalTo(self.contentView)
        };
        
        self.nameLabel = UILabel.init()
        self.nameLabel?.text = "  添加新银行卡"
        self.nameLabel?.textColor = HexRGBAlpha(0xffb25d, 1)
        self.nameLabel?.textAlignment = .left
        self.nameLabel?.font = UIFont.systemFont(ofSize: 15)
        self.bgImgView?.addSubview(self.nameLabel!)
        self.nameLabel?.snp.makeConstraints{(make) in
            make.width.equalTo(120)
            make.height.equalTo(25)
            make.centerX.equalToSuperview().offset(11)
            make.centerY.equalToSuperview().offset(-10)
        }
        
        self.iconImgView = UIImageView.init()
        self.iconImgView?.image = imageNamed("icon_withdraw_add_bank")
        self.bgImgView?.addSubview(self.iconImgView!)
        self.iconImgView?.snp.makeConstraints{(make) in
            make.width.equalTo(22)
            make.height.equalTo(22)
            make.centerY.equalToSuperview().offset(-10)
            make.right.equalTo((self.nameLabel?.snp.left)!)
        }
    }
    
    func setData(isNoBank:Bool) -> Void {
        if isNoBank == false {
             self.bgImgView?.image = imageNamed("icon_withdraw_add_bank_bg")
            self.nameLabel?.snp.remakeConstraints{(make) in
                make.width.equalTo(120)
                make.height.equalTo(25)
                make.centerX.equalToSuperview().offset(11)
                make.centerY.equalToSuperview().offset(-10)
            }
            self.iconImgView?.snp.remakeConstraints{(make) in
                make.width.equalTo(22)
                make.height.equalTo(22)
                make.centerY.equalToSuperview().offset(-10)
                make.right.equalTo((self.nameLabel?.snp.left)!)
            }
        }else{
             self.bgImgView?.image = imageNamed("icon_withdraw_add_bank_bg2")
            self.nameLabel?.snp.remakeConstraints{(make) in
                make.width.equalTo(120)
                make.height.equalTo(25)
                make.centerX.equalToSuperview().offset(11)
                make.centerY.equalToSuperview()
            }
            self.iconImgView?.snp.remakeConstraints{(make) in
                make.width.equalTo(22)
                make.height.equalTo(22)
                make.centerY.equalToSuperview()
                make.right.equalTo((self.nameLabel?.snp.left)!)
            }
        }
    }
}
